"Region setup" panel

This panel enables the user to define regions of various shapes within the data. These can be used for analysis specific parts of the data, e.g. by computing the total flux present or generating maps of individual structures. They can also be used for hiding and cataloguing sources. Regions can be generated within FRELLED but also saved and imported using an external file.

Regions are named according to the the syntax "Prefix_00N" where the prefix is specified in the text box (default, "Name" - PLEASE change this to something more interesting !) and the counter in the adjacent numerical slider. The counter starts from 1. New regions are added with the "Add" button. If a region of the same full exact name already exists, the counter will be incremented by 1 until an empty slot exists. E.g. if the user tries to create Galaxy_005 but this already exists, FRELLED will try to create Galaxy_006, 007 etc. until there is no match with the existing regions.

The drop-down menu selects the shape for new regions. Note that most analysis functionality assumes cuboid regions, and will not give the correct answer if other shapes are used !
A special option "WholeCube" creates a region of the exact size of the entire FITS data set.

The "rename" button attempts to change the prefix of the selected regions, but retains the counter value. If there is a conflict with another existing region, it will warn the user in the terminal but make no changes to the region names.

The "Add" button creates a new region of the specified shape and, if possible name, at the current 3D cursor position (see "Navigation" panel). Regions are added to both 3D and 2D modes, so when you switch from one to the other, the same regions will remain visible. See the "Working with regions" quickstart below.

The "Delete" button deletes all selected regions. This includes checks to ensure that only selected REGIONS are deleted and not any other objects.


The "Import" and "Export" buttons allow the user to save and load the selected regions to external files. Regions are saved in both image pixel coordinates ("BlenderMask.txt") and world coordinates ("WCSMask.txt"). Both currently assume cuboid, non-rotated regions. Only the BlenderMask file correctly preserves the exact size of the regions.
By default, the Import button will opt for BlenderMask if both files exist.
The region files are given the extension _00N.txt, where N is a numerical counter which is updated according to the files already present. Region files are never overwritten. When exporting regions, at least one must be selected or no file will be written. Importing regions always uses the file with the highest counter value (i.e. the latest file written).


The "(Un)select" button toggles the selection status of selected regions.

The colour box sets the colour to display for the selected regions in the 3D view (default black).

"Wire/Solid/Hybrid" buttons set how the display the selected regions :
- "Wire" : use a transparent wireframe. Useful for highlighting a particular part of the data whilst still keeping it fully visible.
- "Solid" : show as an opaque box. Useful for hiding distracting features, e.g. when cataloguing sources.
- "Hybrid" : show an opaque box with the complete wireframe outline. In this way the full extent of the source is visible but the data within the boundary is hidden.


WORKING WITH REGIONS
Regions can be selected with the GUI controls described above but also by right mouse clicking on any part of them. To select multiple regions (and/or unselect regions already selected) right click while holding down shift. To (un)select all regions, either : use "0" in the counter; or place the mouse pointer in the 3D window and press A on the keyboard (note that this may select other objects as well).

Regions exist only within Blender and do not alter the FITS file in any way.

Blender's objects differentiate between a selection and active status. Both are highlighted with an outline. The active object (the last object selected) is given a different colour. There can only ever be one object active at any time, but there is no limit on the number that can be selected.

The outline colour visibility depends on the selection status and the display mode for each region :
- Wireframe objects will be white when unselected, blue when selected, and light blue when active.
- Solid objects will have a white outline (blocked by their internal opaque region) when unselected, which is not visible when they are selected or active. 
- Hybrid objects have the same appearance as wirefame objects regarding their selection status, except that the data within them is hidden from view.

To move a region, select it. Ensure the mouse pointer is within the 3D viewing window. Press G (for "grab") on the keyboard (press once, do not hold). The region can then be moved across the plane of the screen using the mouse. Left click to accept its new position when happy, or right click to cancel and restore its original position.

Regions can be resized in much the same way using the S key ("scale").

After pressing either G or S, the user can also press X/Y/Z on the keyboard to constrain the movement or scaling to a single axis. As well as using the mouse, the user can also then type numerical values on the keyboard to be exact, e.g. "G", "X", "-5" will move the region 5 pixels to the left.

It is also possible to rotate objects with the R key. However, this is not currently well supported in FRELLED. This should be used ONLY for masking features and nothing else !

To move an existing region to an exact world coordinate, enter the coordinates in the Navigation panel and use the "Take me there !" button to position the 3D cursor. With the region selected (ensure only one region is selected !), press shift+S and choose "Selection to cursor".